<template>
	<view class="content">
		<view class="course-wrap">
			<navigator :url="'/pages/tabbar/study/details/index?id=' + item.id + '&type=0'" hover-class="none" class="item"
			 v-for="(item, index) in list" :key="item.id">
				<view class="item-content">
					<view>
						<image :src="item.img" class="item-img"></image>
					</view>
					<view class="item-right">
						<view class="item-title">{{ item.title}}</view>
						<view v-html="ToText(item.content)" class="item-desc"></view>
						<view class="item-num">
							<image class="item-icon" src='../../../../../../static/course/icon-2man.png'></image>
							<text>{{item.readVolume}}</text>
						</view>
					</view>
				</view>
			</navigator>
		</view>
	</view>
	<!--  -->


</template>

<script>
	export default {
		name: "videoContent",
		props: {
			list: {
				type: Array,
				default: function() {
					return [];
				}
			}

		},
		methods: {
			ToText(HTML) {
				var input = HTML;
				return input.replace(/<(style|script|iframe)[^>]*?>[\s\S]+?<\/\1\s*>/gi, '').replace(/<[^>]+?>/g, '').replace(
					/\s+/g, ' ').replace(/ /g, ' ').replace(/>/g, ' ');
			}
		}
	}
</script>

<style lang="less">
	// 列表
	.container {
		overflow: hidden;
		
	}

	.course-wrap {
		background-color: #fff;
		height: 100%;
		border-radius: 10upx;
		box-shadow: 0 0 10px #eaeaea;
		width: 710upx;
		margin: 10px auto;
	}

	.item:first-child {
		.item-content {
			border-top: 0;
		}
	}

	.item {
		position: relative;
		padding: 0 29upx;

		&-content {
			display: flex;
			align-items: center;
			padding: 20upx 0;
			border-top: 1px #dddddd solid;
			background-color: #fff;
		}

		&-tag {
			position: absolute;
			right: 0;
			top: 0;
			background-color: #4a96f2;
			border-bottom-left-radius: 8upx;
			color: #FFFFFF;
			font-size: 18upx;
			padding: 0 5upx;
		}

		&-img {
			width: 243upx;
			height: 167upx;
			border-radius: 8upx;
		}

		&-right {
			margin-left: 20upx;
		}

		&-title {
			font-size: 28upx;
			color: #333;
			font-weight: bold;
			line-height: 36upx;
		}

		&-desc {
			font-size: 24upx;
			color: #666;
			display: -webkit-box;
			-webkit-box-orient: vertical;
			-webkit-line-clamp: 3;
			height: 100upx;
			overflow: hidden;
			padding: 8upx 0 0 0;
		}

		&-num {
			font-size: 20upx;
			color: #999999;
		}

		&-icon {
			width: 21upx;
			height: 20upx;
			margin-right: 4upx;

		}
	}
</style>
